home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_std / character_ref.e < prev    next >
Encoding:
Text File  |  1997-04-13  |  1.3 KB  |  71 lines  |  [TEXT/ttxt]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class CHARACTER_REF
  5.  
  6. inherit
  7.    COMPARABLE 
  8.       redefine compare, out_in_tagged_out_memory, 
  9.      fill_tagged_out_memory
  10.       end;
  11.    
  12. creation make
  13.  
  14. feature 
  15.    
  16.    item: CHARACTER;
  17.  
  18.    make(value: CHARACTER) is
  19.       do
  20.      item := value;
  21.       end;
  22.     
  23. feature
  24.    
  25.    set_item(value: like item) is
  26.       do
  27.      item := value;
  28.       end;
  29.  
  30.    infix "<" (other: like Current): BOOLEAN is
  31.      -- Is Current less than `other'?
  32.       do
  33.      Result := item < other.item
  34.       end;
  35.  
  36.    compare (other: like Current) : INTEGER is
  37.      -- Compare Current with `other'.
  38.      -- '<' <==> Result < 0
  39.      -- '>' <==> Result > 0
  40.      -- Otherwise Result = 0
  41.       do
  42.      Result := code - other.code
  43.       end;
  44.  
  45.    code: INTEGER is
  46.      -- ASCII code of Current
  47.       do
  48.      Result := item.code
  49.       end;
  50.    
  51.    to_upper: like Current is
  52.      -- Conversion of Current to upper case
  53.       do
  54.      !!Result.make (item.to_upper)
  55.       end;
  56.  
  57.    to_lower: like Current is
  58.      -- Conversion of Current to lower case
  59.       do
  60.      !!Result.make (item.to_lower)
  61.       end;
  62.  
  63. feature -- Object Printing :
  64.  
  65.    out_in_tagged_out_memory, fill_tagged_out_memory is
  66.       do
  67.      item.fill_tagged_out_memory;
  68.       end;
  69.  
  70. end -- CHARACTER_REF
  71.